<template>
  <div class="">
    <router-link :to="{ name: 'Main' }">主页</router-link>
  </div>
</template>
<script lang="ts">
  import { Vue, Component } from 'vue-property-decorator'
  import { Snake, Horse, Animal } from '@/assets/Object/Animal'
  import { Rhino, Employee, Animal2 } from '@/assets/Object/Animal2'
  import { buildName, buildName2, buildName3 } from '@/assets/Function/name'
  import { identity, loggingIdentity } from '@/assets/Genericity/test'

  @Component
  export default class Test2 extends Vue {
    init1 () {
      let sam = new Snake('Sammy the Python')
      let tom:Animal = new Horse('Tommy the Palomino')
      sam.move()
      tom.move(34)
    }

    init2 () {
      let animal2 = new Animal2('Goat')
      let rhino = new Rhino()
      let employee = new Employee('Bob')
      animal2 = rhino
      // animal2 = employee
      console.log(animal2)
      console.log(rhino)
      console.log(employee)
    }

    init3 () {
      buildName('defore')
      buildName2('tom')
      buildName3('zero')
    }

    init4 () {
      let str = identity<string>('defore')
      let num = identity<number>(1111)
      interface Person {
        name: string,
        age: number
      }
      let length = loggingIdentity<Person>([{ name: 'defore', age: 24}])
      console.log(str, num)
    }

    created () {
      // this.init1()
      // this.init2()
      // this.init3()
      this.init4()
    }
  }
</script>
<style lang="scss" scoped>
</style>
